package com.sihai.ehr.service;

import java.util.List;

import com.sihai.core.Limit;
import com.sihai.core.LimitedList;
import com.sihai.core.Sorter;
import com.sihai.ehr.model.biz.ExamQualScore;
import com.sihai.ehr.model.biz.ExamQualScoreDetail;
import com.sihai.ehr.model.biz.ExamQualTargetAuditing;
import com.sihai.ehr.model.sys.ExamShowYearlyEnum;
import com.sihai.ehr.model.sys.ExaminePeriodEnum;
import com.sihai.ehr.web.pojo.ExamQualScoreItemPojo;
import com.sihai.ehr.web.pojo.ExamQualScorePojo;

/**
 * 定性考核打分服务
 * 
 * @author Henry
 * 
 */
public interface ExamQualScoreService {
	/**
	 * 获取定性考核员工分数
	 * 
	 * @param id
	 * @return
	 */
	ExamQualScore getExamQualScore(Long id);

	/** 获取定性考核员工分数 */
	ExamQualScore getExamQualScore(Long periodId, Long workId);

	/**
	 * 获取定性考核打分明细对象
	 * 
	 * @param id
	 * @return
	 */
	ExamQualScoreDetail getExamQualScoreDetail(Long id);

	/**
	 * 根据打分编号及项目编号获取详细打分对象
	 * 
	 * @param scoreId
	 * @param itemId
	 * @return
	 */
	ExamQualScoreDetail getExamQualScoreDetailByScItemId(Long scoreId,
			Long itemId);

	/**
	 * 获取期数未打分记录
	 * @param organizationId
	 * @param dutyIds
	 * @param periodEnum
	 * @param period
	 * @param year
	 * @param month
	 * @param status
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScorePojo> searchNotInputExamQualScores(Long organizationId,
			String dutyIds, ExaminePeriodEnum periodEnum, Long period,
			int year, int month, int status, Limit limit, Sorter sorter);
	/**
	 * 获取定性考核打分对象集合
	 * 
	 * @param organizationId
	 *            组织架构ID
	 * @param dutyIds
	 *            职务ID集
	 * @param periodEnum
	 *            考核周期类型
	 * @param period
	 *            考核期数
	 * @param year
	 * @param month
	 * @param status
	 *            打分状态{0:未打分,1:已打分}
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScorePojo> searchExamQualScores(Long organizationId,
			String dutyIds, ExaminePeriodEnum periodEnum, Long period,
			int year, int month, int status, Limit limit, Sorter sorter);
	/**
	 * 获取需要定性考核打分审核对象集合 
	 * @param organizationId
	 * @param dutyIds
	 * @param periodEnum
	 * @param period
	 * @param year
	 * @param month
	 * @param status
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScorePojo> searchRequestAuditExamQualScores(Long organizationId,
			String dutyIds, ExaminePeriodEnum periodEnum, Long period,
			int year, int month, int status, Limit limit, Sorter sorter);
	/**
	 * 搜索已经审核定性打分列表
	 * @param organizationId
	 * @param dutyIds
	 * @param periodEnum
	 * @param period
	 * @param year
	 * @param month
	 * @param status
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScorePojo> searchHasAuditExamQualScores(Long organizationId,
			String dutyIds, ExaminePeriodEnum periodEnum, Long period,
			int year, int month, int status, Limit limit, Sorter sorter);
	
	/**
	 * 统计指定状态搜索结果
	 * @param organizationId
	 * @param dutyIds
	 * @param periodType
	 * @param period
	 * @param status
	 * @return
	 */
	Long searchExamDistQualScoreCountByStatus(
			final Long organizationId, final String dutyIds,
			final ExaminePeriodEnum periodType, final Long period,
			final int status);

	/**
	 * 搜索雇员定性考核分数列表
	 * 
	 * @param workId
	 * @param periodEnum
	 * @param year
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScore> searchEmployeeExamQualScores(Long workId,
			ExaminePeriodEnum periodEnum, int year, Limit limit, Sorter sorter);

	/**
	 * 根据定性考核打分ID获取打分明细
	 * 
	 * @param examscoreId
	 * @param topOrgId
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScoreItemPojo> searchExamQualScoreDetails(
			Long examscoreId, Long topOrgId, Limit limit, Sorter sorter);

	/**
	 * 根据定性考核打分对象获取打分集合
	 * 
	 * @param examQualScore
	 *            定性考核员工对象
	 * @param examShowYearlyEnum
	 *            显示年度类型
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScore> searchExamQualScores(
			ExamQualScore examQualScore, ExamShowYearlyEnum examShowYearlyEnum,
			Limit limit, Sorter sorter);

	/**
	 * 保存定性考核打分对象
	 * 
	 * @param examQualScore
	 */
	void saveExamQualScore(ExamQualScore examQualScore);
	/** 保存审核流程 */
	void saveQualTargetAuditingProcess(ExamQualScore examQualScore, int auditNo);

	/**
	 * 保存定性考核打分明细
	 * 
	 * @param examQualScoreDetail
	 */
	void saveExamQualScoreDetail(ExamQualScoreDetail examQualScoreDetail);

	/**
	 * 移出定性考核打分ID集合
	 * 
	 * @param examQualScoreIds
	 */
	void removeExamQualScores(String examQualScoreIds);

	/**
	 * 移动定性考核打分明细记录集合
	 * 
	 * @param examQualScoreDetailIds
	 */
	void removeExamQualScoreDetails(String examQualScoreDetailIds);

	/**
	 * 查询分布定性打分列表
	 * 
	 * @param organizationId
	 * @param dutyIds
	 * @param periodType
	 * @param period
	 * @param status
	 * @param scoreStart
	 * @param scoreEnd
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<ExamQualScorePojo> searchExamDistQualScores(
			Long organizationId, String dutyIds, ExaminePeriodEnum periodType,
			Long period, int status, Float scoreStart, Float scoreEnd,
			Limit limit, Sorter sorter);
	/**
	 * 获取审核结果集
	 * @param scoreId
	 * @param limit
	 * @param sorter
	 * @return
	 */
	List<List<ExamQualTargetAuditing>> searchQualScoreTargetAuditings(Long scoreId, Limit limit, Sorter sorter);
	
	/** 分析非当前审核用户未完成的审核的个数 */
	Long analyseCountNOCurrentAuditing(final Long organizationId, final String dutyIds,
			final ExaminePeriodEnum periodType, final Long period,
			final int status,Long currentAuditerId);
}
